﻿#light

namespace Examples

module StateMonad =

 open FML.StateM

 let count l = 
    let rec proc l = match l with
                    |[] -> stateM {return ()}
                    |_::t -> stateM { do! modify ((+) 1)
                                      return! proc t
                                    }
    retreiveState (run (proc l) 0)


 let runSamples =
 printf "\n State Monad \n\n"
 printf "%A\n" (count [])
 printf "%A\n" (count [1;2;3])





